/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="voucher")
public class Voucher implements Serializable {
	public Voucher() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.VoucherTemplate voucherTemplate;
	
	private cn.imvc.app.entities.Member member;
	
	private String name;
	
	private String code;
	
	private String description;
	
	private String goodsBrand;
	
	private String goodsClass;
	
	private String goodsType;
	
	private java.util.Date startDate;
	
	private java.util.Date endDate;
	
	private Integer price;
	
	private cn.imvc.app.entities.Orders order;
	
	private String orderCode;
	
	private Integer limitMoney;
	
	private Byte state;
	
	private String verify;
	
	private String goodsBrandName;
	
	private String goodsClassName;
	
	private String goodsTypeName;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_VOUCHER_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_VOUCHER_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 名称
	 */
	public void setName(String value) {
		this.name = value;
	}
	
	/**
	 * 名称
	 */
	@Column(name="name", nullable=true, length=255)	
	public String getName() {
		return name;
	}
	
	/**
	 * 编码
	 */
	public void setCode(String value) {
		this.code = value;
	}
	
	/**
	 * 编码
	 */
	@Column(name="code", nullable=true, length=255)	
	public String getCode() {
		return code;
	}
	
	/**
	 * 发放说明
	 */
	public void setDescription(String value) {
		this.description = value;
	}
	
	/**
	 * 发放说明
	 */
	@Column(name="description", nullable=true, length=255)	
	public String getDescription() {
		return description;
	}
	
	/**
	 * 使用商品品牌id逗号分隔
	 */
	public void setGoodsBrand(String value) {
		this.goodsBrand = value;
	}
	
	/**
	 * 使用商品品牌id逗号分隔
	 */
	@Column(name="goodsBrand", nullable=true, length=255)	
	public String getGoodsBrand() {
		return goodsBrand;
	}
	
	/**
	 * 使用商品类别id逗号分隔
	 */
	public void setGoodsClass(String value) {
		this.goodsClass = value;
	}
	
	/**
	 * 使用商品类别id逗号分隔
	 */
	@Column(name="goodsClass", nullable=true, length=255)	
	public String getGoodsClass() {
		return goodsClass;
	}
	
	/**
	 * 使用商品类型id逗号分隔
	 */
	public void setGoodsType(String value) {
		this.goodsType = value;
	}
	
	/**
	 * 使用商品类型id逗号分隔
	 */
	@Column(name="goodsType", nullable=true, length=255)	
	public String getGoodsType() {
		return goodsType;
	}
	
	/**
	 * 有效期开始时间
	 */
	public void setStartDate(java.util.Date value) {
		this.startDate = value;
	}
	
	/**
	 * 有效期开始时间
	 */
	@Column(name="startDate", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getStartDate() {
		return startDate;
	}
	
	/**
	 * 有效期结束时间
	 */
	public void setEndDate(java.util.Date value) {
		this.endDate = value;
	}
	
	/**
	 * 有效期结束时间
	 */
	@Column(name="endDate", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getEndDate() {
		return endDate;
	}
	
	/**
	 * 面额
	 */
	public void setPrice(int value) {
		setPrice(new Integer(value));
	}
	
	/**
	 * 面额
	 */
	public void setPrice(Integer value) {
		this.price = value;
	}
	
	/**
	 * 面额
	 */
	@Column(name="price", nullable=true, length=10)	
	public Integer getPrice() {
		return price;
	}
	
	/**
	 * 使用代金券的订单编号
	 */
	public void setOrderCode(String value) {
		this.orderCode = value;
	}
	
	/**
	 * 使用代金券的订单编号
	 */
	@Column(name="orderCode", nullable=true, length=255)	
	public String getOrderCode() {
		return orderCode;
	}
	
	/**
	 * 订单限额
	 */
	public void setLimitMoney(int value) {
		setLimitMoney(new Integer(value));
	}
	
	/**
	 * 订单限额
	 */
	public void setLimitMoney(Integer value) {
		this.limitMoney = value;
	}
	
	/**
	 * 订单限额
	 */
	@Column(name="limitMoney", nullable=true, length=10)	
	public Integer getLimitMoney() {
		return limitMoney;
	}
	
	/**
	 * 状态 0未用 1已用 2过期
	 */
	public void setState(byte value) {
		setState(new Byte(value));
	}
	
	/**
	 * 状态 0未用 1已用 2过期
	 */
	public void setState(Byte value) {
		this.state = value;
	}
	
	/**
	 * 状态 0未用 1已用 2过期
	 */
	@Column(name="state", nullable=true)	
	public Byte getState() {
		return state;
	}
	
	/**
	 * 校验码  使用品牌,使用类别,使用类型,价格
	 */
	public void setVerify(String value) {
		this.verify = value;
	}
	
	/**
	 * 校验码  使用品牌,使用类别,使用类型,价格
	 */
	@Column(name="verify", nullable=true, length=255)	
	public String getVerify() {
		return verify;
	}
	
	public void setGoodsBrandName(String value) {
		this.goodsBrandName = value;
	}
	
	@Column(name="goodsBrandName", nullable=true, length=1000)	
	public String getGoodsBrandName() {
		return goodsBrandName;
	}
	
	public void setGoodsClassName(String value) {
		this.goodsClassName = value;
	}
	
	@Column(name="goodsClassName", nullable=true, length=1000)	
	public String getGoodsClassName() {
		return goodsClassName;
	}
	
	public void setGoodsTypeName(String value) {
		this.goodsTypeName = value;
	}
	
	@Column(name="goodsTypeName", nullable=true, length=1000)	
	public String getGoodsTypeName() {
		return goodsTypeName;
	}
	
	public void setVoucherTemplate(cn.imvc.app.entities.VoucherTemplate value) {
		this.voucherTemplate = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.VoucherTemplate.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="voucherTemplateId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.VoucherTemplate getVoucherTemplate() {
		return voucherTemplate;
	}
	
	public void setMember(cn.imvc.app.entities.Member value) {
		this.member = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Member.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="memberId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Member getMember() {
		return member;
	}
	
	public void setOrder(cn.imvc.app.entities.Orders value) {
		this.order = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Orders.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="orderId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Orders getOrder() {
		return order;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Voucher[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getVoucherTemplate() != null)
				sb.append("VoucherTemplate.Persist_ID=").append(getVoucherTemplate().toString(true)).append(" ");
			else
				sb.append("VoucherTemplate=null ");
			if (getMember() != null)
				sb.append("Member.Persist_ID=").append(getMember().toString(true)).append(" ");
			else
				sb.append("Member=null ");
			sb.append("Name=").append(getName()).append(" ");
			sb.append("Code=").append(getCode()).append(" ");
			sb.append("Description=").append(getDescription()).append(" ");
			sb.append("GoodsBrand=").append(getGoodsBrand()).append(" ");
			sb.append("GoodsClass=").append(getGoodsClass()).append(" ");
			sb.append("GoodsType=").append(getGoodsType()).append(" ");
			sb.append("StartDate=").append(getStartDate()).append(" ");
			sb.append("EndDate=").append(getEndDate()).append(" ");
			sb.append("Price=").append(getPrice()).append(" ");
			if (getOrder() != null)
				sb.append("Order.Persist_ID=").append(getOrder().toString(true)).append(" ");
			else
				sb.append("Order=null ");
			sb.append("OrderCode=").append(getOrderCode()).append(" ");
			sb.append("LimitMoney=").append(getLimitMoney()).append(" ");
			sb.append("State=").append(getState()).append(" ");
			sb.append("Verify=").append(getVerify()).append(" ");
			sb.append("GoodsBrandName=").append(getGoodsBrandName()).append(" ");
			sb.append("GoodsClassName=").append(getGoodsClassName()).append(" ");
			sb.append("GoodsTypeName=").append(getGoodsTypeName()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
